package com.zhongli.devplatform.security.qq;

import com.zhongli.devplatform.bean.SecurityUser;
import org.springframework.security.authentication.AbstractAuthenticationToken;

/**
 * @author WuXiCheng
 * @version 1.0
 */
public class QQAuthenticationToken extends AbstractAuthenticationToken {


    private String qqId;
    private SecurityUser securityUser;


    public QQAuthenticationToken(String qqId) {

        super(null);
        super.setAuthenticated(false);// 注意这个构造方法是认证时使用的
        this.qqId = qqId;
    }

    public QQAuthenticationToken(String qqId, SecurityUser user) {
        super(user.getAuthorities());
        this.qqId = qqId;
        this.securityUser = user;
    }

    public String getQqId() {
        return qqId;
    }

    @Override
    public Object getCredentials() {
        return qqId;
    }

    @Override
    public Object getPrincipal() {

        return securityUser;
    }
}
